package com.lvkerry.orderfood.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;

/**
 * @author Kerry
 */

@Entity
@Table(name = "t_user_desk")
public class UserDeskEntity {

    private Long userId;
    private Integer tableNo;

    @JsonBackReference
    private UserEntity userEntity;


    @Id
    @Column(name = "user_id", nullable = false, unique = true)
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "table_no", nullable = false)
    public Integer getTableNo() {
        return tableNo;
    }

    public void setTableNo(Integer deskId) {
        this.tableNo = deskId;
    }

    @OneToOne(mappedBy = "userDeskEntity", cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
    public UserEntity getUserEntity() {
        return userEntity;
    }

    public void setUserEntity(UserEntity userEntity) {
        this.userEntity = userEntity;
    }

}
